package tvv.levelup.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tvv.levelup.models.Comment;
import tvv.levelup.repository.CommentRepository;

/**
 * Created by VLAD on 09.09.2014.
 */
@Service
public class CommentService implements ICommentService{

    @Autowired
    private CommentRepository commentRepository;

    @Override
    public Comment saveComment(String message, long authorId) {
        return commentRepository.save(
                new Comment(message, authorId)
        );
    }

    @Override
    public void deleteComment(Comment comment){
        commentRepository.delete(comment);
    }

    @Override
    public Comment findCommentById(long id){
        return commentRepository.findOne(id);
    }


}
